package vip.xiaonuo.common.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zjt
 * @description
 * @date 2025/3/6 17:45
 */
public abstract class CommonExcelListener<T> extends AnalysisEventListener<T> {

    private List<T> list = new ArrayList<>();

    @Override
    public void invoke(T t, AnalysisContext analysisContext) {
        customAnalyse(t, analysisContext);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }

    public abstract void customAnalyse(T t, AnalysisContext analysisContext);

    public void add(T t) {
        list.add(t);
    }

    public List<T> getExcelResult() {
        return list;
    }
}
